import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { HydratedDocument } from 'mongoose';
import { BaseEntity } from 'src/common/schema/baseEntity.schema';

export type DogDocument = HydratedDocument<Dog>;

@Schema({
  collection: 'dogs', // 指定集合名称
  timestamps: {
    currentTime: () => Date.now(),
    createdAt: 'createTime',
    updatedAt: 'updateTime',
  },
})
export class Dog extends BaseEntity {
  @Prop()
  name: string;

  @Prop()
  age: number;

  @Prop()
  breed: string;
}

export const DogSchema = SchemaFactory.createForClass(Dog);
